package com.halley.servicecontract.service;

import com.halley.servicecontract.entity.User;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;
import java.util.Optional;

@FeignClient(name="service-provider2")
public interface BookService {

    @PostMapping("/user")
    void add(@RequestBody User user);

    @GetMapping("/user/{name}")
    Optional<User> findByName(@PathVariable String name);

    @GetMapping("/users")
    List<User> findAll();
}
